<?php

/* @var $this \yii\web\View */
/* @var $content string */

use yii\helpers\Html;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs;
use frontend\assets\AppAsset;
use common\widgets\Alert;

AppAsset::register($this);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
<head>
    <meta charset="<?= Yii::$app->charset ?>">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <?= Html::csrfMetaTags() ?>
    <title><?= Html::encode($this->title) ?></title>
    <?php $this->head() ?>
</head>
<body>
<?php $this->beginBody() ?>

<div class="wrap">
    <?php
    NavBar::begin([
        'brandLabel' => '我的论坛',
        'brandUrl' => Yii::$app->homeUrl,
        'options' => [
            'class' => 'navbar-inverse navbar-fixed-top',
        ],
    ]);
    $leftMenus = [
        ['label' => Yii::t('yii', 'Home'), 'url' => ['/site/index']],
        ['label' => Yii::t('language', 'article'), 'url' => ['/article/index']],
    ];

    echo Nav::widget([
        'options' => ['class' => 'navbar-nav navbar-left'],
        'items' => $leftMenus,
    ]);

    if (Yii::$app->user->isGuest) {
        $rightMenus[] = ['label' => Yii::t('language', 'signup'), 'url' => ['/site/signup']];
        $rightMenus[] = ['label' => Yii::t('language', 'login'), 'url' => ['/site/login']];
    } else {
        /*$rightMenus[] = '<li>'
            //. Html::beginForm(['/site/logout'], 'post')
            . Html::submitButton(
                '<image src="/statics/images/small/avatar.jpg" alt="'.Yii::$app->user->identity->username.'">',
                //['class' => 'btn btn-link']
                ['class' => 'avatar']
            )
            . Html::endForm()
            . '</li>';*/


        $rightMenus[] = [
            'label' => '<img src="'.Yii::$app->params['avatar']['small'].'" alt="'.Yii::$app->user->identity->username.'">',
            'linkOptions' => ['class' => 'avatar'],
            'items' => [
                ['label' => '<i class="fa fa-user"></i> 个人中心', 'url' => ['/site/logout'], 'linkOptions' => ['data-method' => 'post']],
                ['label' => '<i class="fa fa-star"></i> 我的收藏', 'url' => ['/site/logout'], 'linkOptions' => ['data-method' => 'post']],
                ['label' => '<i class="fa fa-sign-out"></i> 退出登录', 'url' => ['/site/logout'], 'linkOptions' => ['data-method' => 'post']],
            ]
        ];
    }
    echo Nav::widget([
        'options' => ['class' => 'navbar-nav navbar-right'],
        //关掉编码，否则会造成只是显示代码，并不会显示出你想要的效果
        'encodeLabels' => false,
        'items' => $rightMenus,
    ]);
    NavBar::end();
    ?>

    <div class="container">
        <?= Breadcrumbs::widget([
            'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
        ]) ?>
        <?= Alert::widget() ?>
        <?= $content ?>
    </div>
</div>

<div class="footer">
  <div class="container">
    <div class="footer-link">
      <a href="/about/index.html" title="关于我们">关于我们</a>
      <a href="#" title="意见反馈">意见反馈</a>
      <a href="https://www.baidu.com/s?ie=UTF-8&amp;wd=site%3Aphpzhi.com" target="_blank" title="站长统计">站长统计</a>
    </div>
    <div class="friendly-link">
      <span>友情链接：</span>    
                       
            <a href="http://blog.duicode.com/" target="_blank" title="怼码人生">怼码人生</a>
            
    </div>
  </div>
    <div class="footer-copyright">
        <b>Copyright © <?= date('Y')?> All Rights Reserved | 桂ICP备16007331号</b>    
        <!-- <div style="width:300px;margin:0 auto; padding:20px 0;">
            <a target="_blank" href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=33010802003496" style="display:inline-block;text-decoration:none;height:20px;line-height:20px;"><img src="/themes/yiicn/images/beian/beian.png" style="float:left;"><p style="float:left;height:20px;line-height:20px;margin: 0px 0px 0px 5px; color:#939393;">浙公网安备号</p></a>
        </div>
         -->
    </div>
</div>

<?php $this->endBody() ?>
</body>
</html>
<?php $this->endPage() ?>
